#include "TypePoint.h"
#include <cmath>

using FloatPoint::equalEps;

TPoint3DSphere::TPoint3DSphere(const TPoint3DCartesian & p)
{
    this->r = std::sqrt(p.x * p.x + p.y * p.y + p.z * p.z);
    this->theta = std::atan2(p.y, p.x);
    this->phi = std::acos(p.z / this->r);
}

TPoint3DCartesian::TPoint3DCartesian(const TPoint3DSphere & p)
{
    using std::sin;
    using std::cos;
    this->x = p.r * sin(p.theta) * cos(p.phi);
    this->y = p.r * sin(p.theta) * sin(p.phi);
    this->z = p.r * cos(p.theta);
}

bool TPoint3DSphere::operator ==(const TPoint3DSphere& rhs) const
{
    return equalEps(this->phi, rhs.phi) && equalEps(this->r, rhs.r) && equalEps(this->theta, rhs.theta);
}

bool TPoint3DSphere::operator <(const TPoint3DSphere& rhs) const
{

}

bool TPoint3DCartesian::operator ==(const TPoint3DCartesian& rhs) const
{
    return equalEps(this->x, rhs.x) && equalEps(this->y, rhs.y) && equalEps(this->z, rhs.z);
}

bool TPoint3DCartesian::operator <(const TPoint3DCartesian& rhs) const
{

}

